package mortal.game.model
{
	import Message.Db.Tables.*;
	import mortal.game.resource.*;
	import mortal.game.rules.*;
	import mortal.game.scene.map.*;
	
	public class BossRefreshInfo extends Object
	{
		private var _mapId:int;
		private var _px:int;
		private var _py:int;
		private var _plan:int;
		private var _order:int;
		private var _bosses:Array;
		private var _bossRefreshs:Array;
		private var _actBosses:Array;
		
		public function BossRefreshInfo()
		{
			this._bosses = [];
			this._bossRefreshs = [];
			this._actBosses = [];
			
		}
		
		public function get mapId() : int
		{
			return this._mapId;
		}
		
		public function get px() : int
		{
			return this._px;
		}
		
		public function get py() : int
		{
			return this._py;
		}
		
		public function get plan() : int
		{
			return this._plan;
		}
		
		public function get bosses() : Array
		{
			return this._bosses;
		}
		
		public function get bossRefreshs() : Array
		{
			return this._bossRefreshs;
		}
		
		public function get order() : int
		{
			return this._order;
		}
		
		public function addActBoss(param1:TBoss) : void
		{
			this._actBosses.push(param1);
			
		}
		
		public function removeActBoss(param1:TBoss) : void
		{
			var _loc_2:int = 0;
			if (this._actBosses.length != 0)
			{
				_loc_2 = this._actBosses.indexOf(param1);
				if (_loc_2 != -1)
				{
					this._actBosses.splice(_loc_2, 1);
				}
			}
			
		}
		
		public function get actBosses() : Array
		{
			return this._actBosses;
		}
		
		public function clearActBoss() : void
		{
			if (this._actBosses.length != 0)
			{
				this._actBosses.splice(0);
			}
			
		}
		
		public function updateData(param1:int, param2:int, param3:int, param4:int, param5:int) : void
		{
			var _loc_6:int = 0;
			var _loc_8:TBossRefresh = null;
			var _loc_9:TBoss = null;
			this._bossRefreshs.splice(0);
			this._bosses.splice(0);
			this._mapId = param1;
			this._px = param2;
			this._py = param3;
			this._plan = param4;
			this._order = param5;
			this._bossRefreshs = BossRefreshConfig.instance.getInfoByMapPlan(this._mapId, this._plan);
			var _loc_7:* = this._bossRefreshs.length;
			while (_loc_6 < _loc_7)
			{
				
				_loc_8 = this._bossRefreshs[_loc_6];
				//_loc_9 = BossConfig.instance.getInfoByName(_loc_8.code);
				this._bosses.push(_loc_9);
				_loc_6++;
			}
			
		}
		
		public function getNormalBoss() : TBoss
		{
			var _loc_1:TBoss = null;
			var _loc_2:int = 0;
			var _loc_3:TBoss = null;
			var _loc_4:TBoss = null;
			if (this._actBosses.length != 0)
			{
				for each (_loc_1 in this._actBosses)
				{
					
					if (_loc_1.camp <= 3)
					{
						_loc_4 = _loc_1;
						if (GameMapUtil.isCopyMap(MapFileUtil.mapID))
						{
							_loc_3 = _loc_1;
							continue;
						}
						//_loc_2 = BossRule.getBossType(_loc_1.code);
						//if (_loc_2 != BossRule.EliteBoss && _loc_2 != BossRule.RareBoss && _loc_2 != BossRule.BossBoss)
						//{
							//_loc_3 = _loc_1;
						//}
					}
				}
			}
			if (_loc_3 == null)
			{
				for each (_loc_1 in this._bosses)
				{
					
					if (_loc_1.camp <= 3)
					{
						_loc_4 = _loc_1;
						if (GameMapUtil.isCopyMap(MapFileUtil.mapID))
						{
							_loc_3 = _loc_1;
							continue;
						}
						//_loc_2 = BossRule.getBossType(_loc_1.code);
						//if (_loc_2 != BossRule.EliteBoss && _loc_2 != BossRule.RareBoss && _loc_2 != BossRule.BossBoss)
						//{
							//_loc_3 = _loc_1;
						//}
					}
				}
			}
			if (_loc_3 == null)
			{
				_loc_3 = _loc_4;
			}
			return _loc_3;
		}
		
	}
}
